<!--
 * @Author: your name
 * @Date: 2022-03-31 17:46:51
 * @LastEditTime: 2022-03-31 17:49:07
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \geyao\geyao\浅拷贝实现方式4slice220331.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>浅拷贝实现方式4</title>
</head>

<body>
  <script>
    let arr = [1, 3, {
      username: ' 歌谣'
    }];
    let arr3 = arr.slice();
    arr3[2].username = '方方'
    console.log(arr); // [ 1, 3, { username: '方方' } ]
  </script>
</body>

</html>